package tsing.javase.async;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.TimerTask;


/**
 * 异步工厂：产生任务用
 *
 * @Author Tsing/吴清平
 * @Date 2022/10/18 15:16
 * @Version 1.0
 */
public class AsyncFactory {
    private static final Logger logger = LoggerFactory.getLogger("asynclog");

    public static TimerTask recordLoginInfo(final String username,final String status,final String message,final Object ... orgs){

        return new TimerTask(){
            @Override
            public void run() {
                try {
                    Thread.sleep(2000); //休眠2s
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                logger.info("login_username:"+username);
                logger.info("login_status:"+status);
                logger.info("login_mesage:"+message);

            }
        };
    }
}
